package com.mlethe.wifitest;

import android.content.Context;

import com.mlethe.wifitest.adapter.RecyclerAdapter;
import com.mlethe.wifitest.adapter.ViewHolder;

import java.text.SimpleDateFormat;
import java.util.List;

public class MainAdapter extends RecyclerAdapter<Receive> {

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");

    public MainAdapter(Context context, List<Receive> data) {
        super(context, data, R.layout.item_text);
    }

    @Override
    public void convert(ViewHolder holder, Receive item, int position) {
        holder.setText(R.id.receive_text, item.getMsg())
                .setText(R.id.receive_time, sdf.format(item.getDate()));
    }
}
